import requests
import json

'''
放入回收站
'''


class RecycleApi:

    def __init__(self):
        pass

    def recycle(self, token, appId):
        headers = {
            'User-Agent': 'RestSharp/107.3.0.0',
            'Accept': 'application/json, text/json, text/x-json, text/javascript, application/xml, text/xml',
            'Content-Type': 'application/json; application/json; charset=utf-8',
            'timezone': '%2b08%3a00',
            'ipv4': '172.31.96.1',
            'Accept-Language': 'zh-CN,zh;q=1',
            'Authorization': f'bearer {token}',
        }

        json_data = {
            'appId': appId,
        }

        response = requests.post('https://api.winrobot360.com/api/client/recycle/recycle', headers=headers,
                                 json=json_data)
        try:
            json_data = response.json()
            formatted_json = json.dumps(json_data, indent=4, ensure_ascii=False)
            print("JSON Content:")
            print(formatted_json)

            return json_data
        except json.JSONDecodeError:
            print("Response is not valid JSON")


if __name__ == '__main__':
    token = '593b8e85-c705-452e-bac0-2b8011fa0538'
    appId = '61437238-834a-4d9d-b68b-27654ff90cfd'
    recycleApi = RecycleApi()
    recycleApi.recycle(token, appId)
